
import java.awt.Color;

/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
/**
 *
 * @author AKBAL
 */


public class iCarro extends javax.swing.JFrame {

    Radio miradio = new Radio();
    boolean grabar=false;

    /**
     * Creates new form iCarro
     */
    
    
    
    public iCarro() {
        super("Hoja de Trabajo 1");
        initComponents();
        //pantalla.setVisible(false);
        jRadioButton1.setSelected(true);
        jButton2.setBackground(Color.red);
        buttonGroup1.add(jRadioButton1);
        buttonGroup1.add(jRadioButton2);

        if (miradio.IsAm() == true) {
            jLabel4.setText("A.M");
            fm1.setEnabled(false);
            fm2.setEnabled(false);
            fm3.setEnabled(false);
            fm4.setEnabled(false);
            fm5.setEnabled(false);
            fm6.setEnabled(false);
            fm7.setEnabled(false);
            fm8.setEnabled(false);
            fm9.setEnabled(false);
            fm10.setEnabled(false);
            fm11.setEnabled(false);
            fm12.setEnabled(false);
            jRadioButton1.setSelected(true);

        } else {
            jLabel4.setText("F.M");
            am1.setEnabled(false);
            am2.setEnabled(false);
            am3.setEnabled(false);
            am4.setEnabled(false);
            am5.setEnabled(false);
            am6.setEnabled(false);
            am7.setEnabled(false);
            am8.setEnabled(false);
            am9.setEnabled(false);
            am10.setEnabled(false);
            am11.setEnabled(false);
            am12.setEnabled(false);
            jRadioButton2.setSelected(true);





        }
        pantalla.setText(String.valueOf(miradio.GetFreq()));

        if (miradio.IsOn() == true) {
            jRadioButton1.setEnabled(true);
            jRadioButton2.setEnabled(true);
        } else {
            jRadioButton1.setEnabled(false);
            jRadioButton2.setEnabled(false);
        }


    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jButton3 = new javax.swing.JButton();
        fm9 = new javax.swing.JButton();
        fm10 = new javax.swing.JButton();
        fm5 = new javax.swing.JButton();
        fm7 = new javax.swing.JButton();
        fm12 = new javax.swing.JButton();
        fm8 = new javax.swing.JButton();
        fm11 = new javax.swing.JButton();
        am7 = new javax.swing.JButton();
        am5 = new javax.swing.JButton();
        am11 = new javax.swing.JButton();
        am8 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        am3 = new javax.swing.JButton();
        am1 = new javax.swing.JButton();
        am9 = new javax.swing.JButton();
        am12 = new javax.swing.JButton();
        am2 = new javax.swing.JButton();
        am10 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        fm2 = new javax.swing.JButton();
        fm1 = new javax.swing.JButton();
        fm3 = new javax.swing.JButton();
        fm6 = new javax.swing.JButton();
        fm4 = new javax.swing.JButton();
        am4 = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();
        pantalla = new javax.swing.JLabel();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();
        am6 = new javax.swing.JButton();
        guardar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jButton3.setText("<");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        fm9.setText("9");
        fm9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fm9ActionPerformed(evt);
            }
        });

        fm10.setText("10");
        fm10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fm10ActionPerformed(evt);
            }
        });

        fm5.setText("5");
        fm5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fm5ActionPerformed(evt);
            }
        });

        fm7.setText("7");
        fm7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fm7ActionPerformed(evt);
            }
        });

        fm12.setText("12");
        fm12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fm12ActionPerformed(evt);
            }
        });

        fm8.setText("8");
        fm8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fm8ActionPerformed(evt);
            }
        });

        fm11.setText("11");
        fm11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fm11ActionPerformed(evt);
            }
        });

        am7.setText("7");
        am7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                am7ActionPerformed(evt);
            }
        });

        am5.setText("5");
        am5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                am5ActionPerformed(evt);
            }
        });

        am11.setText("11");
        am11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                am11ActionPerformed(evt);
            }
        });

        am8.setText("8");
        am8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                am8ActionPerformed(evt);
            }
        });

        jButton4.setText(">");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        am3.setText("3");
        am3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                am3ActionPerformed(evt);
            }
        });

        am1.setText("1");
        am1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                am1ActionPerformed(evt);
            }
        });

        am9.setText("9");
        am9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                am9ActionPerformed(evt);
            }
        });

        am12.setText("12");
        am12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                am12ActionPerformed(evt);
            }
        });

        am2.setText("2");
        am2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                am2ActionPerformed(evt);
            }
        });

        am10.setText("10");
        am10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                am10ActionPerformed(evt);
            }
        });

        jLabel1.setText("F.M");

        jLabel2.setText("A.M");

        fm2.setText("2");
        fm2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fm2ActionPerformed(evt);
            }
        });

        fm1.setText("1");
        fm1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fm1ActionPerformed(evt);
            }
        });

        fm3.setText("3");
        fm3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fm3ActionPerformed(evt);
            }
        });

        fm6.setText("6");
        fm6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fm6ActionPerformed(evt);
            }
        });

        fm4.setText("4");
        fm4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fm4ActionPerformed(evt);
            }
        });

        am4.setText("4");
        am4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                am4ActionPerformed(evt);
            }
        });

        jLabel4.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 100)); // NOI18N
        jLabel4.setText("A.M");

        jButton2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 11)); // NOI18N
        jButton2.setText("off");
        jButton2.setToolTipText("");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        pantalla.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 100)); // NOI18N
        pantalla.setText("530.0");

        buttonGroup1.add(jRadioButton1);
        jRadioButton1.setText("A.M");
        jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton1ActionPerformed(evt);
            }
        });

        buttonGroup1.add(jRadioButton2);
        jRadioButton2.setText("F.M");
        jRadioButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton2ActionPerformed(evt);
            }
        });

        am6.setText("6");
        am6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                am6ActionPerformed(evt);
            }
        });

        guardar.setText("Guardar");
        guardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                guardarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(160, 160, 160)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel1))
                        .addGap(35, 35, 35)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addComponent(am1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(am2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(am3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(am4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(am5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(am6)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(am7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(am8)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(am9)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(am10)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(am11)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(am12))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(fm1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(fm2)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(fm3)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(fm4)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(fm5))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(guardar)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jRadioButton1)
                                        .addGap(18, 18, 18)
                                        .addComponent(jRadioButton2)
                                        .addGap(102, 102, 102))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(fm6)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(fm7)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel4)
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(fm8)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(fm9)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(fm10)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(fm11)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(fm12))))))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(44, 44, 44)
                        .addComponent(pantalla, javax.swing.GroupLayout.PREFERRED_SIZE, 395, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(37, 37, 37)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(pantalla, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jRadioButton1)
                            .addComponent(jRadioButton2))
                        .addGap(26, 26, 26))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(guardar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(fm1)
                    .addComponent(jLabel1)
                    .addComponent(fm2)
                    .addComponent(fm3)
                    .addComponent(fm4)
                    .addComponent(fm5)
                    .addComponent(fm6)
                    .addComponent(fm7)
                    .addComponent(fm9)
                    .addComponent(fm10)
                    .addComponent(fm11)
                    .addComponent(fm12)
                    .addComponent(fm8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(am1)
                    .addComponent(am2)
                    .addComponent(am3)
                    .addComponent(am4)
                    .addComponent(am5)
                    .addComponent(am6)
                    .addComponent(am7)
                    .addComponent(am8)
                    .addComponent(am9)
                    .addComponent(am11)
                    .addComponent(am12)
                    .addComponent(am10))
                .addGap(29, 29, 29))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void fm9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fm9ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(9);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(9);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_fm9ActionPerformed

    private void fm10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fm10ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(10);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(10);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_fm10ActionPerformed

    private void fm5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fm5ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(5);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(5);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_fm5ActionPerformed

    private void fm7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fm7ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(7);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(7);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_fm7ActionPerformed

    private void fm12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fm12ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(12);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(12);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_fm12ActionPerformed

    private void fm8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fm8ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(8);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(8);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_fm8ActionPerformed

    private void fm11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fm11ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(11);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(11);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_fm11ActionPerformed

    private void am7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_am7ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(7);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(7);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_am7ActionPerformed

    private void am5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_am5ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(5);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(5);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_am5ActionPerformed

    private void am11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_am11ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(11);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(11);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_am11ActionPerformed

    private void am8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_am8ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(8);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(8);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_am8ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        // TODO add your handling code here:
        miradio.NextFreq();
        pantalla.setText(String.valueOf(miradio.GetFreq()));

    }//GEN-LAST:event_jButton4ActionPerformed

    private void am3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_am3ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(3);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(3);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_am3ActionPerformed

    private void am1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_am1ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(1);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(1);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_am1ActionPerformed

    private void am9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_am9ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(9);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(9);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_am9ActionPerformed

    private void am12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_am12ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(12);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(12);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_am12ActionPerformed

    private void am2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_am2ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(2);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(2);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_am2ActionPerformed

    private void am10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_am10ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(10);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(10);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_am10ActionPerformed

    private void fm2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fm2ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(2);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(2);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_fm2ActionPerformed

    private void fm1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fm1ActionPerformed
        // TODO add your handling code here:
        
        if(grabar==true){
            miradio.SaveFreq(1);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(1);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_fm1ActionPerformed

    private void fm3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fm3ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(3);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(3);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_fm3ActionPerformed

    private void fm6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fm6ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(6);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(6);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_fm6ActionPerformed

    private void fm4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fm4ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(4);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(4);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_fm4ActionPerformed

    private void am4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_am4ActionPerformed
        // TODO add your handling code here:
        if(grabar==true){
            miradio.SaveFreq(4);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(4);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_am4ActionPerformed

    private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed
        // TODO add your handling code here:
        if (miradio.IsOn() == true) {
            if (miradio.IsAm() == false) {
                miradio.ChangeSignal();
                pantalla.setText(String.valueOf(miradio.GetFreq()));
                jLabel4.setText("A.M");
                fm1.setEnabled(false);
                fm2.setEnabled(false);
                fm3.setEnabled(false);
                fm4.setEnabled(false);
                fm5.setEnabled(false);
                fm6.setEnabled(false);
                fm7.setEnabled(false);
                fm8.setEnabled(false);
                fm9.setEnabled(false);
                fm10.setEnabled(false);
                fm11.setEnabled(false);
                fm12.setEnabled(false);



                am1.setEnabled(true);
                am2.setEnabled(true);
                am3.setEnabled(true);
                am4.setEnabled(true);
                am5.setEnabled(true);
                am6.setEnabled(true);
                am7.setEnabled(true);
                am8.setEnabled(true);
                am9.setEnabled(true);
                am10.setEnabled(true);
                am11.setEnabled(true);
                am12.setEnabled(true);
            }
        }

    }//GEN-LAST:event_jRadioButton1ActionPerformed

    private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed
        // TODO add your handling code here:

        if (miradio.IsOn() == true) {
            if (miradio.IsAm() == true) {
                miradio.ChangeSignal();
                pantalla.setText(String.valueOf(miradio.GetFreq()));
                jLabel4.setText("F.M");
                fm1.setEnabled(true);
                fm2.setEnabled(true);
                fm3.setEnabled(true);
                fm4.setEnabled(true);
                fm5.setEnabled(true);
                fm6.setEnabled(true);
                fm7.setEnabled(true);
                fm8.setEnabled(true);
                fm9.setEnabled(true);
                fm10.setEnabled(true);
                fm11.setEnabled(true);
                fm12.setEnabled(true);

                am1.setEnabled(false);
                am2.setEnabled(false);
                am3.setEnabled(false);
                am4.setEnabled(false);
                am5.setEnabled(false);
                am6.setEnabled(false);
                am7.setEnabled(false);
                am8.setEnabled(false);
                am9.setEnabled(false);
                am10.setEnabled(false);
                am11.setEnabled(false);
                am12.setEnabled(false);
            }
        }
    }//GEN-LAST:event_jRadioButton2ActionPerformed

    private void am6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_am6ActionPerformed
        // TODO add your handling code here:
        //miradio.SaveFreq(0);

        if(grabar==true){
            miradio.SaveFreq(6);
            guardar.setBackground(null);
            grabar=false;
        }
        else{
        miradio.ChangeTune(6);
        }
        
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_am6ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:

        miradio.Power();
        if (miradio.IsOn() == true) {
            System.out.println("entro");
            System.out.println(String.valueOf(miradio.IsOn()));
            jButton2.setBackground(Color.GREEN);
            jButton2.setText("on");
            jRadioButton1.setEnabled(true);
            jRadioButton2.setEnabled(true);
        } else {
            System.out.println(String.valueOf(miradio.IsOn()));
            jButton2.setBackground(Color.RED);
            jButton2.setText("off");
            jRadioButton1.setEnabled(false);
            jRadioButton2.setEnabled(false);
        }




    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        // TODO add your handling code here:
        miradio.PreviousTune();
        pantalla.setText(String.valueOf(miradio.GetFreq()));
    }//GEN-LAST:event_jButton3ActionPerformed

    private void guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guardarActionPerformed
        // TODO add your handling code here:
        if (miradio.IsOn() == true) {
           if(grabar==false){
               guardar.setBackground(Color.YELLOW);
           
            grabar=true;}
           else{
               guardar.setBackground(null);
           grabar=false;
           }
            
        }
    }//GEN-LAST:event_guardarActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(iCarro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(iCarro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(iCarro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(iCarro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new iCarro().setVisible(true);

            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton am1;
    private javax.swing.JButton am10;
    private javax.swing.JButton am11;
    private javax.swing.JButton am12;
    private javax.swing.JButton am2;
    private javax.swing.JButton am3;
    private javax.swing.JButton am4;
    private javax.swing.JButton am5;
    private javax.swing.JButton am6;
    private javax.swing.JButton am7;
    private javax.swing.JButton am8;
    private javax.swing.JButton am9;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton fm1;
    private javax.swing.JButton fm10;
    private javax.swing.JButton fm11;
    private javax.swing.JButton fm12;
    private javax.swing.JButton fm2;
    private javax.swing.JButton fm3;
    private javax.swing.JButton fm4;
    private javax.swing.JButton fm5;
    private javax.swing.JButton fm6;
    private javax.swing.JButton fm7;
    private javax.swing.JButton fm8;
    private javax.swing.JButton fm9;
    private javax.swing.JButton guardar;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JLabel pantalla;
    // End of variables declaration//GEN-END:variables
}
